{% extends "mainapp/base.html" %}

{% load static %}
{% load bootstrap %}

{% block title %} 产品和型号管理 {% endblock %}


{% block content %}

    <h3 class="text-left">添加ProductType和LotNumber数据</h3>
    <div class="row">
        <div class="col-3">
            <form method="post" novalidate>
                {% csrf_token %}
                <div class="mb-3">
                    <label for="ProductType" class="form-label">产品类型</label>
                    {{ form.ProductType|add_class:"form-control" }}
                </div>
                <div class="mb-3">
                    <label for="LotNumber" class="form-label">批号</label>
                    {{ form.LotNumber|add_class:"form-control" }}
                </div>
                <button type="submit" class="btn btn-primary">提交</button>
            </form>
        </div>
        <div class="col-6">
            {% if form.errors %}
                <div class="alert alert-danger mt-3">
                    <strong>提交错误:</strong>
                    <ul>
                        {% for field, errors in form.errors.items %}
                            {% for error in errors %}
                                <li>{{ field }}: {{ error }}</li>
                            {% endfor %}
                        {% endfor %}
                    </ul>
                </div>
            {% endif %}
        </div>
    </div>

{% endblock %}